"""
URL configuration for 电商项目 project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from app_user.views import account, user_info, home, order,pay,management,test

urlpatterns = [

    path("admin/", admin.site.urls),


   #登录界面

    path('login/', account.login),
    path('logout/', account.logout),
    path('image/code/', account.image_code),
    path('register/', account.register),
    path('user/active/<str:token>/', account.user_active),




    # 用户信息界面
    path('user/list/', user_info.user_list),
    path('user/info/', user_info.user_info),
    path('user/info/edit/', user_info.user_info_edit),
    path('user/address/', user_info.address),
    path('add/address/', user_info.add_address),
    path('default/address/', user_info.default_address),
    path('delete/address/', user_info.delete_address),
    path('cart/', user_info.cart),
    path('delete/cart/<int:id>/', user_info.delete_cart),




    #主页

    path('insert/', home.insert_goods),
    path('home/', home.home),
    path('detail/<int:id>/', home.detail),
    path('type/list/<int:id>/<int:sort>/', home.type_list),

    path('add/cart/', home.add_cart),
    path('check/price/', home.check_price),
    path('search/goods/', home.search_goods),
    path('comment/add/<int:id>/', home.comment_add),





    #订单

    path('order/', order.order),
    path('add/order/', order.add_order),
    path('delete/order/', order.delete_order),


    path('add/single/order/<int:id>/<int:num>/', order.add_single_order),
    path('add/create/order/', order.create_order),



    #支付
    path('alipay/<int:oid>/', pay.alipay),
    path('pay/alipayback/<int:oid>/', pay.alipayback),

    #后台管理
    path('management/', management.management),
    path('management/user/', management.management_user),
    path('edit/account/<int:id>/', management.edit_account),
    path('delete/account/', management.delete_account),
    path('management/goods/', management.management_goods),
    path('management/delete/goods/', management.management_goods_delete),
    path('management/up/goods/', management.management_goods_up),
    path('management/down/goods/', management.management_goods_down),
    path('management/edit/goods/<int:id>/', management.management_goods_edit),

    path('management/sales/', management.management_sales_goods),
    path('management/sales/management/default/recommendation/', management.management_default_recommendation),
    path('management/sales/management/delete/recommendation/', management.management_delete_recommendation),
    path('management/sales/visualization/', management.management_sales),
    path('management/sales/data.json', management.management_sales_get_data),

    path('test/', test.test),
    path('get_data/', test.get_data),
    path('my_view/', test.my_view),


]
